<?php if (!defined('ITPK')) exit('You can not directly access the file.');

/**
 * COOKIE操作类
 * @author 冬天的秘密
 * @link http://bbs.itpk.cn
 * @version 1.0
 */

class WebcookiePer extends WebDBConnection {

	/**
	 * 获取COOKIE
	 * @param string $uin
	 * @return array | boolean
	 */
	public function getMeByUin($uin) {
		return $this->db->executeQuery("SELECT * FROM web_cookie WHERE uin = '{$uin}' ORDER BY id ASC LIMIT 1", true);
	}

	/**
	 * 更新或添加COOKIE
	 * @param string $uin
	 * @param string $cookie
	 * @param string $ptwebqq
	 * @param string $vfwebqq
	 * @param string $psessionid
	 * @param string $clientid
	 * @return boolean
	 */
	public function replaceMe($uin, $cookie, $ptwebqq, $vfwebqq, $psessionid, $clientid) {
		$count = $this->db->executeQuery("REPLACE INTO web_cookie(uin, cookie, ptwebqq, vfwebqq, psessionid, clientid) VALUES('{$uin}', '{$cookie}', '{$ptwebqq}', '{$vfwebqq}', '{$psessionid}', '{$clientid}')");
		return $count > 0 ? true : false;
	}

} 
?>